import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * Author:   anTi
 * Date:     2019/1/4 16:18
 * Description:
 * version: 1.0
 */

public class assd {
    private Lock lock=new ReentrantLock();
    private int i=0;
    public  void getTest() {
        lock.lock();
        try {
            Thread.sleep(1000*6);
            System.out.println("拿到了锁"+(i++));
        } catch (InterruptedException e) {
            e.printStackTrace();
        } finally {
            lock.unlock();
        }
    }
}
